﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

public partial class kecheng_chaxun_laoshi : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            Session["sTittle"] = "老师查询";
            if (Session["sRole"] != null && Session["sRole"].ToString() != "管理员")
            {
                DropDownList1.SelectedValue = Session["sjigou"].ToString();
                DropDownList1.Enabled = false;
            }
        }
    }


    protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
    {
        SqlDataSource2.SelectCommand = "SELECT [username1], [id] FROM [account] WHERE (([jigou] = '" + DropDownList1.SelectedValue + "') AND ([role] = '老师'))";
        DropDownList2.DataBind();
        if (DropDownList2.Items.Count > 0)
        {
            DropDownList2.SelectedIndex = 0;
            SqlDataSource3.SelectCommand = "SELECT [id],[city],[username1], [grjj], [gzdw], [jigou],[email],[mobile] FROM [account] WHERE id=" + DropDownList2.SelectedValue;
        }
        else
        {
            DropDownList2.SelectedIndex = -1;
            SqlDataSource3.SelectCommand = "SELECT [id],[city],[username1], [grjj], [gzdw], [jigou],[email],[mobile] FROM [account] WHERE False";
        }
    }
}
